package com.depin.pdaapp.presenter;

import com.depin.pdaapp.bean.UserBean;
import com.depin.pdaapp.http.NetBiz;
import com.depin.pdaapp.utils.RxSubscriber;
import com.jaydenxiao.common.base.BasePresenter;
import com.vondear.rxtool.view.RxToast;

/**
 * Created by 哼哼
 * Date：2020/8/9 12:19
 * Desc:
 */
public class LoginPresenter extends BasePresenter<LoginPresenter.View> {
    public interface View {
        void loginSuccess(UserBean userbean);
    }

    public void login(String username, String pwd, int type) {
        mRxManage.add(new NetBiz().Login(username, pwd, type).subscribe(new RxSubscriber<UserBean>(mContext) {
            @Override
            protected void _onNext(UserBean userbean) {
                mView.loginSuccess(userbean);
            }

            @Override
            protected void _onError(String message) {
                RxToast.showToast(message);
            }
        }));
    }


}